package main

import (
	"fmt"
	"reflect"
	"strconv"
)

func main() {
	str := "123"
	num, err := strconv.Atoi(str)
	if err != nil {
		panic(err)
	}
	fmt.Printf("字符串转换为int: %d \n", num)
	str1 := strconv.Itoa(num)
	fmt.Printf("int转换为字符串: %s \n", str1)

	ui64, err := strconv.ParseUint(str, 10, 32) //32指的是位数在2^32 - 1（即 0 到 4294967295）之间 ，返回值类型仍然是uint64类型
	fmt.Printf("字符串转换为uint64: %d \n", num, reflect.TypeOf(ui64))

	str2 := strconv.FormatUint(ui64, 2)
	fmt.Printf("uint64转换为字符串: %s \n", str2)
}
